package com.highspeed.bdk.bean.entity.physical;

import com.bianmaba.spring.data.jpa.domain.annotations.QueryCacheable;
import com.highspeed.bdk.bean.base.BaseEntity;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by chenjiabin on 2018/3/23.
 */
@Entity
@DynamicUpdate(true)
@DynamicInsert(true)
@QueryCacheable
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class PhysicalTopology extends BaseEntity {
    @Column(nullable = false, length = 32)
    private String no;

    @Column(nullable = false, length = 16)
    private String name;

    @Column(length = 32)
    private String modifier;

    @Column()
    private Date lastModifyTime;

    @Column(length = 255)
    private String remark;
    @Column(nullable = false)
    private Boolean enabled = true;

    @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "physicalTopology")
    private List<MachineBox> machineBoxes = new ArrayList<MachineBox>(0);

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getModifier() {
        return modifier;
    }

    public void setModifier(String modifier) {
        this.modifier = modifier;
    }

    public Date getLastModifyTime() {
        return lastModifyTime;
    }

    public void setLastModifyTime(Date lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public List<MachineBox> getMachineBoxes() {
        return machineBoxes;
    }

    public void setMachineBoxes(List<MachineBox> machineBoxes) {
        this.machineBoxes = machineBoxes;
    }

    public Boolean getEnabled() {
        return enabled;
    }

    public void setEnabled(Boolean enabled) {
        this.enabled = enabled;
    }
}
